<!--清算账户自动拆借管理审核页面-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('detials', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <!-- 明细弹出框 -->
    <approve-details
      ref="approveDetailsDialog"
      :dictMap="dictMap"
      :formData.sync="formData"
      @editComplete="editComplete"
    ></approve-details>
  </div>
</template>
<script>
import { apiUrlConfig, detail } from "@/api/cnaps/saps/clearAcctAutoMng/clear_manage_approve.js";
import ApproveDetails from "./components/approveDetails";
import { listPageMixin } from "@/libs/listPageMixin";
import { log } from "util";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";

export default {
  name: "clearManageApprove",
  mixins: [listPageMixin],
  components: {
    ApproveDetails,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      //数据字典
      searchFormDictList: ["CD_MNG_TYPE", "PLUSMINUSTYPECODE", "ACTNO_PROC_STATUS"],
      //  明细弹框数据
      // form表单字段
      formData: {
        id: "",
        vdate: "",
        workDate: "",
        directSender: "",
        senderName: "",
        pkgNo: "",
        pkgNoDesc: "",
        adjAmt: "",
        mdTlrno: "",
        mdTime: "",
        audRemarks: "",
      },
      showSearch: true,
      // 查询参数
      queryParams: {
        idSeqNo: "",
        startWorkDate: "",
        endWorkDate: "",
        workdate1: "",
        workdate2: "",
        cdMngType: "",
      },
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        { label: `交易流水号`, prop: "id", width: "270", sortable: false },
        {
          label: `CPG日期`,
          prop: "vdate",

          sortable: false,
          type: "date",
        },
        {
          label: `工作日期`,
          prop: "workdate",

          sortable: false,
          type: "date",
        },
        {
          label: `拆入清算行行号`,
          prop: "cStBrno",

          sortable: false,
        },
        {
          label: `拆出清算行行号`,
          prop: "dStBrno",

          sortable: false,
        },
        {
          label: `拆借协议号`,
          prop: "protoNum",
          sortable: false,
        },
        {
          label: `自动拆借管理类型`,
          prop: "cdMngType",

          dictCode: "CD_MNG_TYPE",
          sortable: false,
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "idSeqNo",
        defaultAttr: {
          label: "交易流水号",
          placeholder: "请输入交易流水号",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "startWorkDate",
          endTimeName: "endWorkDate",
        },
        defaultAttr: {
          label: "CPG日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "dict",
        dict: "CD_MNG_TYPE",
        prop: "cdMngType",
        defaultAttr: {
          label: "自动拆借管理类型",
          placeholder: "请选择自动拆借管理类型",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate1",
          endTimeName: "workdate2",
        },
        defaultAttr: {
          label: "工作日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
    ];
  },
  methods: {
    editComplete(state) {
      if (state == true) {
        this.$refs.dataTable.doQuery();
      }
    },
    handleAction(type, row = {}) {
      switch (type) {
        case "detials":
          // 明细信息
          this.formData = _.clone(row);
          this.$refs.approveDetailsDialog.show();
          break;
      }
    },
  },
};
</script>
